const input = require("scanline");
const connection = require("../db/connection");

async function delAll(){
    showPath();
    const yn = await input("\033[31m你确定要删除全部商品信息吗?[y确认/n取消]\033[0m");
    if(yn === "y" || yn === "Y"){
        connection.query("truncate table product",(error,_)=>{
            if(error){
                console.log("删除内容失败",error);
                process.exit(1);
            }
            console.log("\033[33m你已删除全部商品信息\033[0m");
        });
    }else{
        console.log("\033[33m你已取消该操作\033[0m")
    }
    connection.end();
}

module.exports = delAll;